ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19tb

Dependencies:   mbed

GraphicEngine/GraphicEngine.cpp

Committer:
el19tb
Date:
2020-05-06
Revision:
4:aae7f8d4ab78
Parent:
3:648c9d5001be
Child:
5:6e3afee7eac3

File content as of revision 4:aae7f8d4ab78:

#include "GraphicEngine.h"

N5110 lcd;
GraphicEngine::GraphicEngine(Chicken *chicken){
    this->chick = chicken;
}

void GraphicEngine::init(){
    lcd.init();
}

void GraphicEngine::showChicken(){
    //fill the chicken with black color
    lcd.drawRect(chick->x, chick->y, chick->width, chick->width, FILL_BLACK);
}

// TO DO:
// -> make multiple lanes of cars (first manually then automatically)
// -> make one lane go other direction
// -> make a safety lane
// -> make a logs
// -> make turtles
// -> make the ocean (if collision with ocean then dead)
// -> make multiple lives
// -> point system
// -> make the sprite images
// -> make background object (sprite of entire screen)
// -> make menu screen
// -> collision
// -> make sprite of safety lanes
// -> make snake object
// BONUS:
// --> make multiple levels
// --> time constraint

void GraphicEngine::showCar(Car *car){        
        // safety lane
        lcd.drawRect(0, 48 - 4, 84, 4, FILL_TRANSPARENT);
        lcd.drawRect(0, 48 - 4*6, 84, 4, FILL_TRANSPARENT);
           
        lcd.drawRect(car->left_car.x, car->left_car.y, car->left_car.height, car->left_car.width, FILL_BLACK);
}

void GraphicEngine::contrast(){
    lcd.setContrast(0.4);   
}

void GraphicEngine::clear(){
    lcd.clear();
}

void GraphicEngine::refresh(){
    lcd.refresh();
}

void GraphicEngine::backLightOn(){
    lcd.backLightOn();
}