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:
- 31:eefa1d23a843
- Parent:
- 24:23fd6b451db7
- Child:
- 33:9d34ef219fff
--- a/main.cpp Wed May 08 01:20:06 2019 +0000
+++ b/main.cpp Wed May 08 12:13:28 2019 +0000
@@ -15,6 +15,9 @@
#include "Bat.h"
#include "Cricket.h"
+#define BALL_SIZE 2
+#define BAT_HEIGHT 3
+#define BAT_WIDTH 6
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad mainpad;
Cricket cricket;
@@ -44,40 +47,10 @@
void init(){
lcd.init();
mainpad.init();
- //ball1.init(2,4);
- cricket.init();
- //bat1.init();
- lcd.setContrast(0.4);
- lcd.normalMode(); // normal colour mode
- lcd.setBrightness(0.5);
- lcd.clear();
-
-}
-void welcome() {
- lcd.printString(" CRICKET GAME ",0,1);
- lcd.printString(" SHAHID SAJID",0,2);
- lcd.printString(" el17szs ",0,3);
- lcd.printString(" Press Start ",0,4);
- lcd.refresh();
- // wait flashing LEDs until start button is pressed
- while ( mainpad.check_event(Gamepad::START_PRESSED) == false) {
- printf("Waiting");
- mainpad.leds_on();
- wait(0.1);
- mainpad.leds_off();
- wait(0.1);
- }
- printf("Out of loop");
- lcd.clear();
- lcd.printString(" CRICKET GAME ",0,1);
- lcd.refresh();
- wait(10.0);
-
+ cricket.init(BALL_SIZE,BAT_WIDTH,BAT_HEIGHT);
}
void draw(){
lcd.clear();
cricket.draw(lcd);
- //ball1.draw(lcd);
- //bat1.draw(lcd);
lcd.refresh();
}