demo

Dependencies:   mbed Gamepad N5110

Revision:
0:ba32cfe0051e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Engine/Engine.h	Thu May 14 12:57:32 2020 +0000
@@ -0,0 +1,83 @@
+#ifndef ENGINE_H
+#define ENGINE_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+#include "foods.h"
+#include "rocket.h"
+#include "the_wall.h"
+
+
+class Engine
+{
+
+public:
+    Engine();
+    ~Engine();
+    // constructors
+    /**
+    * @brief Initiates the parameters for every objects
+    * @param wall_width @details Width of Wall
+    * @param wall_gap @details Gap of Wall
+    * @param foods_size and the details Radius of foods
+    * @param speed and details Speed of the moving objects
+    */
+    void init(int wall_width,int wall_gap,int foods_size,int speed);
+    /**
+    * @brief Reads the data input from the joystick
+    * @param Gamepad and details Gamepad that holds the parameters of the joystick
+    */
+    void read_input(Gamepad &pad);
+    /**
+    * @brief Draws every objects on the screen using initiate data/update data
+    * @param N5110 
+    * @details LCD which diaplay the game
+    */
+    void draw(N5110 &lcd);
+    /**
+    * @brief Renews positions for all the objects
+    * @param Gamepad @details Gamepad that holds the parameters of the joystick
+    */
+    void update(Gamepad &pad);
+    /** 
+    * @brief Gets the score
+    * @returns The number of score
+    */
+    int get_final_score(); // get score for the incoming events
+    
+private:
+    void check_wall_collision(Gamepad &pad);
+    void check_score(Gamepad &pad);
+    
+    the_wall _w0;
+    the_wall _w1;
+    the_wall _w2;
+    the_wall _w3;
+    the_wall _w4;
+    
+    int _wall_width;
+    int _wall_gap;
+    int _foods_size;
+    int _velocity;
+    
+    // x positions of the walls
+    int _w0x;
+    int _w1x;
+    int _w2x;
+    int _w3x;
+    int _w4x;
+    int _rocketx;
+    int _foodsx;
+    
+    rocket _rocket;
+    foods _foods;
+    
+    Direction _d;
+    float _mag;
+    Vector2D _mapped_coord;
+
+
+};
+
+#endif
\ No newline at end of file