ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Floors/Floors.cpp

Committer:
el17m2h
Date:
2019-04-16
Revision:
8:90e789413e0b
Parent:
7:0d9cee90ab0d
Child:
9:5e53bca2a4c2

File content as of revision 8:90e789413e0b:

#include "Floors.h"

Floors::Floors(){
}
Floors::~Floors(){
}

void Floors::init(int x, int y, int width, int height){
    _height = height;
    _width = width;
    
    _x = x;
    _y = y;
    
    _velocity.x = 0;
    _velocity.y = 0;
}

void Floors::draw(N5110 &lcd){
    lcd.drawRect(_x, _y, _width, _height, FILL_BLACK);
}

void Floors::update(){
    _current_pos = get_pos();
    _current_vel = get_velocity();
    
    
}


void Floors::set_velocity(Vector2D v){
    _velocity.x = v.x;
    _velocity.y = v.y;
}

Vector2D Floors::get_velocity(){
    Vector2D v = {_velocity.x,_velocity.y};
    return v;
}

Vector2D Floors::get_pos(){
    Vector2D p = {_x,_y};
    return p;
}

void Floors::set_pos(Vector2D p){
    _x = p.x;
    _y = p.y;
}