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: Floors/Floors.cpp
- Revision:
- 1:0001cb3eb053
- Child:
- 2:360a6c301a4e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Floors/Floors.cpp Tue Apr 09 20:15:33 2019 +0000 @@ -0,0 +1,42 @@ +#include "Floors.h" + +Floors::Floors(){ +} +Floors::~Floors(){ +} + +void Floors::init(int height, int width){ + _height = height; + _width = width; + + _x = WIDTH/2 ; // initial floors position + _y = HEIGHT/2; + + _velocity.x = 0; + _velocity.y = 1; +} + +void Floors::draw(N5110 &lcd){ + lcd.drawRect(_x, _y, _height, _width,FILL_BLACK); +} + + +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; +} \ No newline at end of file