contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Tue May 07 15:17:21 2019 +0000
Revision:
40:13b8467526d0
Parent:
39:822b66b1c935
Final Submission. I have read and agreed with Statement of Academic Integrity

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 26:35714debc45f 1 #ifndef TESTS_H
OmarAlebiary 26:35714debc45f 2 #define TESTS_H
OmarAlebiary 26:35714debc45f 3 #include "RocketRacer.h"
OmarAlebiary 26:35714debc45f 4 #include "Menus.h"
OmarAlebiary 28:39607fb67e88 5 #include "GameTones.h"
OmarAlebiary 33:24ef796ff2c8 6
OmarAlebiary 26:35714debc45f 7
OmarAlebiary 33:24ef796ff2c8 8 /** tests class
OmarAlebiary 26:35714debc45f 9
OmarAlebiary 26:35714debc45f 10 @brief C++ class containing the tests for methods
OmarAlebiary 26:35714debc45f 11
OmarAlebiary 26:35714debc45f 12 @version 1.0
OmarAlebiary 26:35714debc45f 13
OmarAlebiary 26:35714debc45f 14 @author Omar Alebiary
OmarAlebiary 26:35714debc45f 15
OmarAlebiary 26:35714debc45f 16 @date April 2019
OmarAlebiary 26:35714debc45f 17
OmarAlebiary 26:35714debc45f 18 @code
OmarAlebiary 26:35714debc45f 19
OmarAlebiary 26:35714debc45f 20 #include "mbed.h"
OmarAlebiary 26:35714debc45f 21 #include "N5110.h"
OmarAlebiary 26:35714debc45f 22 #include "Gamepad.h"
OmarAlebiary 26:35714debc45f 23 #include "RocketRacer.h"
OmarAlebiary 26:35714debc45f 24
OmarAlebiary 26:35714debc45f 25 // objects
OmarAlebiary 26:35714debc45f 26 Gamepad pad;
OmarAlebiary 26:35714debc45f 27 RocketRacer rc;
OmarAlebiary 26:35714debc45f 28 Menus menus;
OmarAlebiary 26:35714debc45f 29 tests test;
OmarAlebiary 26:35714debc45f 30
OmarAlebiary 26:35714debc45f 31
OmarAlebiary 26:35714debc45f 32
OmarAlebiary 26:35714debc45f 33 int main(){
OmarAlebiary 26:35714debc45f 34
OmarAlebiary 26:35714debc45f 35
OmarAlebiary 26:35714debc45f 36 setup();
OmarAlebiary 33:24ef796ff2c8 37 while(1){
OmarAlebiary 33:24ef796ff2c8 38 // test.test_welcomeMenu(pad,lcd);
OmarAlebiary 33:24ef796ff2c8 39 // test.test_Play_Welcome_Melody(pad);
OmarAlebiary 33:24ef796ff2c8 40 // test.test_End_Game_Melody(Gamepad &pad);
OmarAlebiary 33:24ef796ff2c8 41 // test.test_drawMenu(lcd, pad);
OmarAlebiary 33:24ef796ff2c8 42 // test.test_credits_page(lcd,pad);
OmarAlebiary 33:24ef796ff2c8 43 // test.test_loading_menu(lcd);
OmarAlebiary 33:24ef796ff2c8 44 // test.test_InstructionsMenu(pad,lcd);
OmarAlebiary 33:24ef796ff2c8 45 // test.test_Game_Loop(pad,lcd);
OmarAlebiary 33:24ef796ff2c8 46 // test.test_Joystick_position(pad);
OmarAlebiary 33:24ef796ff2c8 47 // test.test_Generate_New_Enemy();
OmarAlebiary 33:24ef796ff2c8 48 // test.test_Joystick_position(pad);
OmarAlebiary 33:24ef796ff2c8 49 // test_check_button_pressed(pad,lcd);
OmarAlebiary 33:24ef796ff2c8 50 test.test_accelerometer_position(pad);
OmarAlebiary 33:24ef796ff2c8 51 }
OmarAlebiary 26:35714debc45f 52
OmarAlebiary 26:35714debc45f 53
OmarAlebiary 26:35714debc45f 54
OmarAlebiary 26:35714debc45f 55
OmarAlebiary 26:35714debc45f 56 }
OmarAlebiary 26:35714debc45f 57
OmarAlebiary 26:35714debc45f 58 @endcode
OmarAlebiary 26:35714debc45f 59 */
OmarAlebiary 26:35714debc45f 60
OmarAlebiary 26:35714debc45f 61
OmarAlebiary 26:35714debc45f 62 class tests{
OmarAlebiary 26:35714debc45f 63
OmarAlebiary 26:35714debc45f 64 public:
OmarAlebiary 29:e660274d8222 65 /**
OmarAlebiary 29:e660274d8222 66 * @brief Default Constructor
OmarAlebiary 29:e660274d8222 67 * @details Creates the object of class tests
OmarAlebiary 29:e660274d8222 68 */
OmarAlebiary 28:39607fb67e88 69 tests();
OmarAlebiary 29:e660274d8222 70 /**
OmarAlebiary 29:e660274d8222 71 * @brief Default destructor
OmarAlebiary 29:e660274d8222 72 * @details destroys the object of class tests
OmarAlebiary 29:e660274d8222 73 */
OmarAlebiary 29:e660274d8222 74 ~tests();
OmarAlebiary 26:35714debc45f 75 /**
OmarAlebiary 26:35714debc45f 76 * @brief method to test welcome menu
OmarAlebiary 26:35714debc45f 77 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 78 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 79 */
OmarAlebiary 26:35714debc45f 80 void test_welcomeMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 26:35714debc45f 81 /**
OmarAlebiary 26:35714debc45f 82 * @brief method to test tones played in the game
OmarAlebiary 26:35714debc45f 83 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 84 */
OmarAlebiary 28:39607fb67e88 85 void test_Play_Welcome_Melody(Gamepad &pad);
OmarAlebiary 28:39607fb67e88 86 /**
OmarAlebiary 28:39607fb67e88 87 * @brief method to test tones played in the game over screen
OmarAlebiary 28:39607fb67e88 88 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 89 */
OmarAlebiary 28:39607fb67e88 90 void test_End_Game_Melody(Gamepad &pad);
OmarAlebiary 26:35714debc45f 91 /**
OmarAlebiary 26:35714debc45f 92 * @brief method to test the draw main menu method
OmarAlebiary 26:35714debc45f 93 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 94 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 95 */
OmarAlebiary 26:35714debc45f 96 void test_drawMenu(N5110 &lcd,Gamepad &pad);
OmarAlebiary 26:35714debc45f 97 /**
OmarAlebiary 26:35714debc45f 98 * @brief method to test the credits page on the menu
OmarAlebiary 26:35714debc45f 99 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 100 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 101 */
OmarAlebiary 26:35714debc45f 102 void test_credits_page(N5110 &lcd,Gamepad &pad);
OmarAlebiary 26:35714debc45f 103 /**
OmarAlebiary 26:35714debc45f 104 * @brief method to test the loading page
OmarAlebiary 26:35714debc45f 105 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 106 */
OmarAlebiary 26:35714debc45f 107 void test_loading_menu(N5110 &lcd);
OmarAlebiary 26:35714debc45f 108 /**
OmarAlebiary 26:35714debc45f 109 * @brief method to test the instructions page
OmarAlebiary 26:35714debc45f 110 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 111 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 112 */
OmarAlebiary 26:35714debc45f 113 void test_InstructionsMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 26:35714debc45f 114 /**
OmarAlebiary 26:35714debc45f 115 * @brief method to test the game loop which has all the game methods calls in it
OmarAlebiary 26:35714debc45f 116 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 117 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 26:35714debc45f 118 */
OmarAlebiary 26:35714debc45f 119 void test_Game_Loop(Gamepad &pad,N5110 &lcd);
OmarAlebiary 29:e660274d8222 120 /**
OmarAlebiary 33:24ef796ff2c8 121 * @brief method to test the position of the joystick and prints its current state and return true
OmarAlebiary 29:e660274d8222 122 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 29:e660274d8222 123 */
OmarAlebiary 29:e660274d8222 124 bool test_Joystick_position(Gamepad &pad);
OmarAlebiary 29:e660274d8222 125 /**
OmarAlebiary 29:e660274d8222 126 * @brief method to test generated numbers
OmarAlebiary 39:822b66b1c935 127 * @details it tests if the randomly genrated number is 1,2 or 3
OmarAlebiary 39:822b66b1c935 128 * @returns true if the condition is met, false otherwise
OmarAlebiary 29:e660274d8222 129 */
OmarAlebiary 29:e660274d8222 130 bool test_Generate_New_Enemy();
OmarAlebiary 33:24ef796ff2c8 131 /**
OmarAlebiary 33:24ef796ff2c8 132 * @brief method to test the position of the accelerometer and prints its current state and return true
OmarAlebiary 33:24ef796ff2c8 133 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 39:822b66b1c935 134 * @returns true if the condition is met, false otherwise
OmarAlebiary 33:24ef796ff2c8 135 */
OmarAlebiary 33:24ef796ff2c8 136 bool test_accelerometer_position(Gamepad &pad);
OmarAlebiary 33:24ef796ff2c8 137 /**
OmarAlebiary 33:24ef796ff2c8 138 * @brief method to test button presses in the menu and return true, false otherwise
OmarAlebiary 33:24ef796ff2c8 139 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 33:24ef796ff2c8 140 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 39:822b66b1c935 141 * @returns true if the condition is met, false otherwise
OmarAlebiary 33:24ef796ff2c8 142 */
OmarAlebiary 33:24ef796ff2c8 143 bool test_check_button_pressed(Gamepad &pad,N5110 &lcd);
OmarAlebiary 26:35714debc45f 144
OmarAlebiary 28:39607fb67e88 145 private:
OmarAlebiary 28:39607fb67e88 146 Menus menu;
OmarAlebiary 28:39607fb67e88 147 RocketRacer Rocket_Racing;
OmarAlebiary 28:39607fb67e88 148 GameTones Game_Tones;
OmarAlebiary 28:39607fb67e88 149
OmarAlebiary 26:35714debc45f 150 };
OmarAlebiary 26:35714debc45f 151
OmarAlebiary 26:35714debc45f 152 #endif