Thomas Davies / Mbed 2 deprecated LetTheBallDrop

Dependencies:   N5110 mbed PowerControl

Embed: (wiki syntax)

« Back to documentation index

main.cpp File Reference

main.cpp File Reference

Source file for main game containing function defintions and main loop. More...

Go to the source code of this file.

Functions

void advancePlatforms (int n)
 Advance Platforms.
bool isBallFalling (int bY)
 Check if ball falling.
bool isBallDirClear (int dir)
 Is Ball Direction Clear?
bool isRight ()
 Is Joystick Right?
bool isLeft ()
 Is Joystick Left?
bool isUp ()
 Is Joystick Up?
bool isDown ()
 Is Joystick Down?
void clockCounter ()
 ISR - Clock Counter.
void endScreenController ()
 Game Over Controller.
char * recordEntryController ()
 Record Entry Controller.
void highScoreEditor (char *playerInitials, bool isRecord)
 High Score Editor.
bool isRecord ()
 is Record?
void boop ()
 PWM speaker control function.
void pwmLow ()
 Boop Helper function.
void pauseScreenController ()
 Pause Screen Controller.
void powerSave ()
 Power Saving Mode.

Detailed Description

Source file for main game containing function defintions and main loop.

Thomas Davies

Date:
May 2015

Definition in file main.cpp.


Function Documentation

void advancePlatforms ( int  n = 1 )

Advance Platforms.

animate platforms shift up n pixels

Parameters:
n- number of pixels to shift

Definition at line 131 of file main.cpp.

void boop (  )

PWM speaker control function.

makes a boop sound used for collisions with platforms.

Definition at line 495 of file main.cpp.

void clockCounter (  )

ISR - Clock Counter.

increments number of clock cycles

Definition at line 266 of file main.cpp.

void endScreenController (  )

Game Over Controller.

Displays end game screen, and allows user interaction with options via joystick. Also controls option selection and next screens.

Definition at line 273 of file main.cpp.

void highScoreEditor ( char *  playerInitials,
bool  isRecord 
)

High Score Editor.

Manages highscore file and recordEntryController().

Definition at line 408 of file main.cpp.

bool isBallDirClear ( int  dir )

Is Ball Direction Clear?

given ball direction determines if path is clear to move.

Parameters:
dir- direction ball is travelling in (0 for left 1 for right)
Returns:
1 if clear 0 if not

Definition at line 178 of file main.cpp.

bool isBallFalling ( int  bY )

Check if ball falling.

Falling if bal is in free space, not on platform

Parameters:
bY- ball Y coordinate
Returns:
1 if falling 0 if not.

Definition at line 153 of file main.cpp.

bool isDown (  )

Is Joystick Down?

reads joystickY value and checks direction

Returns:
1 if down 0 if not.

Definition at line 251 of file main.cpp.

bool isLeft (  )

Is Joystick Left?

reads joystickX value and check direction

Returns:
1 if left 0 if not.

Definition at line 221 of file main.cpp.

bool isRecord (  )

is Record?

check if score achieved by player is a record

Returns:
1 if gameLevel is a record 0 if not

Definition at line 470 of file main.cpp.

bool isRight (  )

Is Joystick Right?

reads joystickX value and check direction

Returns:
1 if right 0 if not.

Definition at line 206 of file main.cpp.

bool isUp (  )

Is Joystick Up?

reads joystickY value and check direction

Returns:
1 if up 0 if not.

Definition at line 236 of file main.cpp.

void pauseScreenController (  )

Pause Screen Controller.

Displays pause screen and allows user interaction to toggle sound,restart, and resume game.

Definition at line 515 of file main.cpp.

void powerSave (  )

Power Saving Mode.

Powers down unused peripherals & ethernet

Definition at line 571 of file main.cpp.

void pwmLow (  )

Boop Helper function.

sets pin low when called, then starts timer to recall Boop();

Definition at line 503 of file main.cpp.

char* recordEntryController (  )

Record Entry Controller.

Displays initial entry screen, allows user to scroll through letters and select initials.

Returns:
intitials entered by user.

Definition at line 345 of file main.cpp.