
Kaif Kutchwala 201267448 ELEC2645 Project
Dependencies: mbed
Game/Game.h
- Committer:
- KaifK
- Date:
- 2020-05-17
- Revision:
- 7:2a3b566aedd3
- Parent:
- 6:09a555c0d997
- Child:
- 8:5ede90f99a27
File content as of revision 7:2a3b566aedd3:
#ifndef GAME_H #define GAME_H #include <cmath> #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "Ball.h" #include "Splash.h" class Game { public: Game(); ~Game(); /** @brief initialise game values*/ void init(); /** @brief reads values user inputs i.e. direction and power (x and y)*/ void readInput(Gamepad &pad, N5110 &lcd); /** @brief updates score on screen*/ void updateScore(N5110 &lcd); /** @brief updates number of lives on leds */ void updateLives(Gamepad &pad); private: /** @brief takes pointer input for aim on x-axis */ void pointer_input(Gamepad &pad, N5110 &lcd); /** @brief takes power input for aim on y-axis */ void power_meter_input(Gamepad &pad, N5110 &lcd); /** @brief converts _x_val from pointer range (8-72) to screen range (0-84) */ void convert_to_shot_x(); /** @brief converts _y_val from power meter range (0-20) to goal range (0-24) */ void convert_to_shot_y(); int _score; int _lives; int _level; int _x_val; int _y_val; int _shot_x; int _shot_y; int _speed; bool _is_goal; }; /** @brief displays constant background w/o obstacles */ void display_background(N5110 &lcd); /** @brief displays obstacles for level * @param level @details number of level */ void displayLevel(int level, N5110 &lcd); /** @brief generates random value for given limit * @param limit @details sets max limit for random generator */ int random_level_gen(int limit); #endif