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:
- 34:d9099874bbc3
- Parent:
- 33:9d34ef219fff
--- a/main.cpp Wed May 08 13:30:12 2019 +0000
+++ b/main.cpp Thu May 09 10:17:13 2019 +0000
@@ -8,6 +8,7 @@
Date: 21/03/2019
*/
+/////////////// pre processor directives /////////////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
@@ -18,37 +19,42 @@
#define BALL_SIZE 2
#define BAT_HEIGHT 3
#define BAT_WIDTH 6
+////////////////////Objects//////////////////////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad mainpad;
Cricket cricket;
+
+////////////////////Prototypes//////////////////////////////
void init();
-
void welcome();
void draw();
-void ball_test();
+
+////////////////////Functions//////////////////////////////
int main(){
int fps=14;
init();
- //welcome();
- //draw();
+ //prints the first intro screen
cricket.intro(lcd);
+ //main game loop
while(1){
-
cricket.game(lcd,mainpad);
draw();
wait(1.0f/fps);
}
}
+//intilialises the game
void init(){
lcd.init();
mainpad.init();
cricket.init(BALL_SIZE,BAT_WIDTH,BAT_HEIGHT);
}
+
+//draws all the game components
void draw(){
lcd.clear();
cricket.draw(lcd);