ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Doodler/Doodler.cpp

Committer:
el17m2h
Date:
2019-04-11
Revision:
4:8ec314f806ae
Child:
5:8814d6de77d0

File content as of revision 4:8ec314f806ae:

#include "Doodler.h"

Doodler::Doodler(){
}
Doodler::~Doodler(){
}

void Doodler::init(int x, int y, int radius){
    _radius = radius;
    
    _x = x;
    _y = y;
    
    _velocity.x = 0;
    _velocity.y = 0;
}

void Doodler::draw(N5110 &lcd){
    lcd.drawCircle(_x, _y, _radius, FILL_BLACK);
}


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

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

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

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