Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

GameEngine/GameEngine.h

Committer:
evanso
Date:
2020-04-28
Revision:
15:90b6821bcf64
Parent:
14:7419c680656f
Child:
16:1ee3d3804557

File content as of revision 15:90b6821bcf64:

#ifndef GAMEENGINE_H
#define GAMEENGINE_H
 
// Included libraries -----------------------------------------------------------
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Spaceship.h"
#include "Map.h"

 
/** GameEngine class
@brief Runs the different parts of the game 
@author Benjamin Evans, University of Leeds
@date April 2020
*/

class GameEngine {
    public:
        /** Constructor */
        GameEngine();
        
        /** Destructor */
        ~GameEngine();
        
        /** Initalises GameEngine */
        void init();
        
        /** Main gameplay loop that runs playable part of game */
        void gameplay_loop();
        
        /** Gets joystick direction from gamepad and stores it in d_*/
        void read_joystick_direction();
        
        
        // Accessors and mutators ----------------------------------------------
          
    private:
        // Function prototypes -------------------------------------------------
    
        /** Calulates the map movement depeding on spaceship positions and joystick input */
        void calculate_map_movement();
    
        // Variables -----------------------------------------------------------
        
        // Changes the drawing x postion of map, 1 moves right, -1 moves left and 0 doesnt change map position 
        int move_map_;
        
        // Direction of joystick
        Direction d_; 
    
        // Objects -------------------------------------------------------------
    
        // Gamepad object 
        Gamepad pad;
        
        // LCD object
        N5110 lcd;
        
        // Spaceship object 
        Spaceship spaceship;
        
        // Map object 
        Map map;  
};
 
#endif