ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Engine/Engine.cpp

Committer:
el17m2h
Date:
2019-04-10
Revision:
2:360a6c301a4e
Child:
3:116913e97fd7

File content as of revision 2:360a6c301a4e:

#include "Engine.h"

Engine::Engine(){
}
Engine::~Engine(){
}

void Engine::init(int floors_height, int floors_width){
    _floors_height = floors_height;
    _floors_width = floors_width;

    _f1x = rand() % 84; // random floors position between 0 and 83 
    _f2x = rand() % 84;
    _f3x = rand() % 84;
    _f4x = rand() % 84;
    _f5x = rand() % 84;
    _f6x = rand() % 84;
    _f7x = rand() % 84;
    _f8x = rand() % 84;
    _f9x = rand() % 84;
    _f10x = rand() % 84;
    _f1y = rand() % 84;
    _f2y = rand() % 84;
    _f3y = rand() % 84;
    _f4y = rand() % 84;
    _f5y = rand() % 84;
    _f6y = rand() % 84;
    _f7y = rand() % 84;
    _f8y = rand() % 84;
    _f9y = rand() % 84;
    _f10y = rand() % 84;
    
    _f1.init(_f1x, _f1y, _floors_height, _floors_width);
    _f2.init(_f2x, _f2y, _floors_height, _floors_width);
    _f3.init(_f3x, _f3y, _floors_height, _floors_width);
    _f4.init(_f4x, _f4y, _floors_height, _floors_width);
    _f5.init(_f5x, _f5y, _floors_height, _floors_width);
    _f6.init(_f6x, _f6y, _floors_height, _floors_width);
    _f7.init(_f7x, _f7y, _floors_height, _floors_width);
    _f8.init(_f8x, _f8y, _floors_height, _floors_width);
    _f9.init(_f9x, _f9y, _floors_height, _floors_width);
    _f10.init(_f10x, _f10y, _floors_height, _floors_width);
}

void Engine::draw(N5110 &lcd){
    _f1.draw(lcd);
    _f2.draw(lcd);
    _f3.draw(lcd);
    _f4.draw(lcd);
    _f5.draw(lcd);
    _f6.draw(lcd);
    _f7.draw(lcd);
    _f8.draw(lcd);
    _f9.draw(lcd);
    _f10.draw(lcd);
    
}