Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Doodler/Doodler.cpp
- Revision:
- 4:8ec314f806ae
- Child:
- 5:8814d6de77d0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doodler/Doodler.cpp Thu Apr 11 14:44:14 2019 +0000 @@ -0,0 +1,41 @@ +#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; +} \ No newline at end of file