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 FATFileSystem
GolfEngine/GolfEngine.h
- Committer:
- ellisbhastroud
- Date:
- 2019-05-08
- Revision:
- 14:08ac9aaa34c3
- Parent:
- 13:681192091568
- Child:
- 16:c8d68cbd1ae2
File content as of revision 14:08ac9aaa34c3:
#ifndef GOLFENGINE_H
#define GOLFENGINE_H
#include "mbed.h"
#include "N5110.h"
#include "SDFileSystem.h"
#include "Gamepad.h"
#include "Ball.h"
/** Golf Engine Class
* @brief Library to run golf game
* @author Ellis Blackford Stroud
* @date May, 2018
*/
class GolfEngine
{
public:
/** Constructor */
GolfEngine();
/** Destructor */
~GolfEngine();
/** Sets values for new game
* @param the frame rate in Hz
*/
void init(int frame_rate);
/** Draws game screen
* @param the class used to interact with the lcd display
*/
void drawGame(N5110 &lcd);
/** Reads input from gamepad
* @param the class used to interact with the gamepad
*/
void read_input(Gamepad &pad);
/** Updates ball position according to input
* @param the class used to interact with the gamepad
*/
void update_ball(Gamepad &pad, N5110 &lcd);
/** Checks if level is over
* @param the class used to interact with the lcd display
* @param the class used to interact with the gamepad
* @param the class used to interact with the sd card
*/
void check_end_level(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
/** Prints current level
* @param the class used to interact with the lcd display
*/
void printLevel(N5110 &lcd);
/** Resets game over flag */
void reset_game_over_flag();
/** Returns game over flag
* @param true if game over and false if now
*/
bool get_game_over_flag();
private:
void drawCourseWalls(N5110 &lcd, WallMap map[], int size);
void drawHole(N5110 &lcd, Coord hole);
void file_append(int value, SDFileSystem &sd);
void new_level(N5110 &lcd, SDFileSystem &sd);
void c_maj(Gamepad &pad);
void g_maj7_flash(Gamepad &pad, N5110 &lcd);
int _level;
bool _game_over_flag;
float _mag;
Vector2D _joy_coord;
float _angle;
Ball _ball;
};
#endif