Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PongEngine/PongEngine.cpp
- Revision:
- 2:b3ca50f2e85d
- Parent:
- 1:e18615d46071
- Child:
- 3:5719d0fe94ed
--- a/PongEngine/PongEngine.cpp Wed Apr 17 21:19:16 2019 +0000
+++ b/PongEngine/PongEngine.cpp Thu Apr 18 15:39:11 2019 +0000
@@ -24,12 +24,23 @@
// puts paddles and ball in middle
_p1.init(_p1y,_paddle_height,_paddle_width);
_ball.init(_ball_size,_speed);
+
+ _grid1.init(3,GAP+1,WIDTH_BRICK,HEIGHT_BRICK); // need to figure out how to make a list of these
+ _grid2.init(13,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid3.init(23,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid4.init(33,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid5.init(43,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid6.init(53,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid7.init(63,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid8.init(73,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
+ _grid9.init(83,GAP+1,WIDTH_BRICK,HEIGHT_BRICK);
}
void PongEngine::read_input(Gamepad &pad)
{
_d = pad.get_direction();
_mag = pad.get_mag();
+ //_pause = pad.check_event(Gamepad::START_PRESSED); // == false then system("PAUSE") or cin.get()
}
void PongEngine::draw(N5110 &lcd)
@@ -43,8 +54,28 @@
_p1.draw(lcd);
// ball
_ball.draw(lcd);
+
+ _grid1.draw(lcd);
+ _grid2.draw(lcd);
+ _grid3.draw(lcd);
+ _grid4.draw(lcd);
+ _grid5.draw(lcd);
+ _grid6.draw(lcd);
+ _grid7.draw(lcd);
+ _grid8.draw(lcd);
+ _grid9.draw(lcd);
+
+
+
+
+// for(int i = GAP+1; i <= WIDTH; i+= WIDTH_BRICK + 1){
+// for(int j = GAP+1; j <= (HEIGHT_BRICK + 1)*3; j+= HEIGHT_BRICK + 1){
+// Vector3d grid[i][j]= _grid.init(i, j,WIDTH_BRICK,HEIGHT_BRICK);
+// }
+// }
}
+
void PongEngine::update(Gamepad &pad)
{
check_goal(pad);