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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 8:7b7e1a5b8200
- Parent:
- 7:a1a6bff238c1
- Child:
- 33:9d34ef219fff
--- a/main.cpp Thu Apr 18 13:04:37 2019 +0000
+++ b/main.cpp Sat Apr 20 20:32:56 2019 +0000
@@ -15,6 +15,8 @@
#include "Bat.h"
+
+
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad1;
Ball ball;
@@ -25,25 +27,28 @@
//void welcome();
void draw();
void ball_test();
-
+void first_menu();
int main(){
int fps=8;
init();
// welcome();
+ //first_menu();
draw();
- /*
- while (1){
- draw();
- wait(1.0f/fps);
- }
- */
+
+ // while (1){
+// draw();
+// wait(1.0f/fps);
+// }
+
float f;
while(1){
+ ball.set_field(lcd);
+ while(1){
f= pad1.get_mag();
printf("MAG %f \n",f);
int lol=bat.get_hitBall();
+ ball.start(lcd,lol,pad1.get_direction());
- ball.start(lcd,lol,pad1.get_direction());
draw();
wait(1.0f/fps);
}
@@ -78,12 +83,24 @@
}
}
+void first_menu(){
+ lcd.clear();
+
+ lcd.printString(" CRICKET",0,1);
+ lcd.printString(" SHAHID SAJID",0,2);
+ lcd.printString(" el17szs",0,3);
+ lcd.drawRect(0,0,WIDTH,HEIGHT,FILL_TRANSPARENT);
+ lcd.refresh();
+ wait(1);
+ lcd.printString("Presss Start",0,4);
+
+ lcd.refresh();
+}
void draw(){
lcd.clear();
lcd.drawCircle((WIDTH/2),HEIGHT/2,23,FILL_TRANSPARENT);
lcd.drawRect(37,11,12,30,FILL_TRANSPARENT);
ball.draw(lcd);
- ball.set_field(lcd);
bat.draw(lcd);
lcd.refresh();
}
@@ -91,7 +108,6 @@
Vector2D ball_pos = ball.get_pos();
Vector2D ball_velocity = ball.get_velocity();
ball.update();
-
ball.set_velocity(ball_velocity);
ball.set_pos(ball_pos);
ball.update();