ELEC2645 (2018/19) / Mbed 2 deprecated el17dtt

Dependencies:   mbed

GameEngine/engine.h

Committer:
batJoro
Date:
2019-05-05
Revision:
9:dc13042b09f5
Parent:
8:b3738229ba85
Child:
10:b939edd9b87c

File content as of revision 9:dc13042b09f5:


#ifndef ENGINE_H
#define ENGINE_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "functions.h"
#include <vector>

struct MapSegment {
    
    float curvature; 
    float meters; 
};
class Engine{

    public:
    Engine();
    ~Engine();
    
    void init(int screenHeight, int screenWidth, int speed);
    void read_input(Gamepad &pad);
    void update(Gamepad &pad, N5110 &lcd, float elapsedTime);
    void draw(N5110 &lcd);
    
    void setSpeed(int speed);
    
    private:
    
    float _curvature;
    
    vector<MapSegment> track; // curvature and distance
    
    float _car_positon;
    float _distance;
    float _speed;
    int _screen_height;
    int _screen_width;
    
    static int car1[];
    static int car2[];
    static int car3[];
};

#endif